package com.frx.test;

/**
 * Created by xurenfeng on 2019/3/18.
 */
public class TreeNode {

    private int val;
    private TreeNode leftNode;
    private TreeNode rightNode;

    public int getMaxDepth(){

        return 0;
    }
    private int getMaxDepth(TreeNode treeNode){
        if (treeNode == null){
            return 0;
        }

        int leftDepth = getMaxDepth(treeNode.leftNode);
        int rightDepth = getMaxDepth(treeNode.rightNode);
        return (leftDepth > rightDepth ? leftDepth : rightDepth) + 1;
    }
}
